package org.hyn.gateway.test;

import org.junit.Test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author franyhu
 * @description 单元测试
 * @date 2025/2/20
 */
public class CollectionTest {

    @Test
    public void test_map() {
        List<String> listInitial = new ArrayList<String>();
        listInitial.add("a");
        listInitial.add("b");
        List<String> list = new ArrayList<String>();
        list.add("a");
        list.add("b");
        list.add("c");
        Map<String, List<String>> roleMap = new HashMap<>();
        roleMap.put("aaa", listInitial);
        roleMap.get("aaa").addAll(list);
        roleMap.put("aaa", roleMap.get("aaa").stream().distinct().collect(Collectors.toList()));

        System.out.println(roleMap);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = br.readLine()) != null) {// 处理多组输入
            int n = Integer.parseInt(line);
            String[] tokens = br.readLine().split(" ");
            int[] arr = new int[n];
            for (int i = 0; i < n; ++i) {
                arr[i] = Integer.parseInt(tokens[i]);
            }
            // 输出数组内容
            for (int x : arr) {
                System.out.print(x + " ");
            }
            System.out.println();
        }
    }

}
